import java.util.Arrays;
import java.util.Scanner;

/**
 * @author gao
 * @date 2025/8/19 14:07
 */

public class Solution {
    public int minimumBoxes(int[] apple, int[] capacity) {
        int sumA = 0, count = 0, sumC = 0;
        for (int i = 0; i < apple.length; i++) {
            sumA += apple[i];
        }
        Arrays.sort(capacity);
        for (int i = capacity.length - 1; i >= 0; i--) {
            if (sumC < sumA) {
                sumC += capacity[i];
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] apple = new int[n];
            for (int i = 0; i < apple.length; i++) {
                apple[i] = in.nextInt();
            }
            int m = in.nextInt();
            int[] capacity = new int[m];
            for (int i = 0; i < capacity.length; i++) {
                capacity[i] = in.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(solution.minimumBoxes(apple, capacity));
        }
    }
}